package com.atguigu.jxc.controller;

import com.atguigu.jxc.domain.ServiceVO;
import com.atguigu.jxc.entity.Supplier;
import com.atguigu.jxc.service.SupplierService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * /supplier/list
 *
 * @author zjr
 * @version 1.0
 */
@RestController
@RequestMapping("/supplier/")
public class SupplierController {
    @Autowired
    SupplierService ss;

    @PostMapping("list")
    public Map<String, Object> supplierList(Integer page, Integer rows, @RequestParam(value = "supplierName", required = false) String supplierName) {
        return ss.supplierList(page, rows, supplierName);
    }

    @PostMapping("save")
    public ServiceVO saveSupplier(@RequestParam(value = "supplierId", required = false) Integer supplierId,
                                  Supplier supplier) {
        return ss.saveSupplier(supplierId, supplier);
    }
    @RequestMapping("delete")
    public ServiceVO deleteSupplier(String ids){
        return ss.deleteSupplier(ids);
    }
}
